import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { from } from 'rxjs';

import {LoginComponent} from './login/login.component'
import {HomeComponent} from './home/home.component'
import {ErrorComponent} from './error/error.component'
import { LayoutComponent } from './layout/layout.component'



const routes: Routes = [
  {
    path:'login',
    component:LoginComponent
  },
  {
    path:'',
    component:LayoutComponent,
    children:[
      {
        path:'',
        component:HomeComponent
      },
      {
        path:'ng-zorro',
        loadChildren: () => import('./ng-zorro/ng-zorro.module').then(m => m.NgZorroModule),
      },
      {
        path:'echarts',
        loadChildren: () => import('./echarts/echarts.module').then(m => m.EchartsModule),
      },
      {
        path:'amap',
        loadChildren: () => import('./amap/amap.module').then(m => m.AmapModule),
      },
      {
        path:'user',
        loadChildren: () => import('./user/user.module').then(m => m.UserModule), //'./user/user.module#ArticleModule'
      },
      {
        path:'order',
        loadChildren: () => import('./order/order.module').then(m => m.OrderModule), 
      },
    ]
  },
  {
    path:'**',
    component:ErrorComponent
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
